package com.naml.i_transtream;

import java.io.*;

/**
 * @author marin
 * @version 1.0
 * @date 2025/4/24 21:51
 * @desc 使用中间转换流解决乱码问题
 */
@SuppressWarnings("all")
public class InputStreamReader01 {
    public static void main(String[] args) {
        BufferedReader br = null;
        try {
            //若读取的文本文件的格式是GBK的，那就指定GBK的编码格式读取
            br = new BufferedReader(new InputStreamReader(new FileInputStream("/Users/marin/new2.txt"), "gbk"));
            System.out.println(br.readLine());
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }finally {
            try {
                br.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

    }
}
